home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- ##
- # DropScript seed script
- #
- # Wilfredo Sanchez | wsanchez@apple.com
- # Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
- ##
- # @APPLE_LICENSE_HEADER_START@
- #
- # The contents of this file constitute Original Code as defined in and
- # are subject to the Apple Public Source License Version 1.1 (the
- # "License"). You may not use this file except in compliance with the
- # License. Please obtain a copy of the License at
- # http://www.apple.com/publicsource and read it before using this file.
- #
- # This Original Code and all software distributed under the License are
- # distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- # License for the specific language governing rights and limitations
- # under the License.
- #
- # @APPLE_LICENSE_HEADER_END@
- ##
-
- # For debugging
- #set -e
- #set -u
- #set -x
-
- ScriptFileName=$1; shift;
-
- if [ $# != 0 ]; then
- echo "Too many arguments."
- exit 64;
- fi;
-
- DropScript="/System/Demos/DropScript.app";
- Destination=$(dirname "${ScriptFileName}");
- DropperName="Drop"$(basename "${ScriptFileName}" | sed 's/\..*$//');
- NewDropper="${Destination}/${DropperName}.app";
-
- if [ ! -f "${ScriptFileName}" ]; then
- echo "Invalid program ${ScriptFileName}.";
- exit 65;
- fi;
-
- if [ ! -d "${DropScript}" ]; then
- echo "Unable to find DropScript application.";
- exit 72;
- fi;
-
- if ! cd "${DropScript}"; then
- echo "Unable to open ${DropScript}.";
- exit 66;
- fi;
-
- if ! mkdir "${NewDropper}" ||
- ! pax -rw . "${NewDropper}"; then
- echo "Unable to create ${NewDropper}.";
- echo "You may have a partially created drop app.";
- exit 73;
- fi;
-
- if ! cp -f "${ScriptFileName}" "${NewDropper}/Contents/Resources/script"; then
- echo "Unable to write script into ${NewDropper}.app";
- echo "You may have a partially created drop app.";
- exit 73;
- fi;
-
- if ! chmod 555 "${NewDropper}/Contents/Resources/script"; then
- echo "Unable to set mode for script.";
- echo "You may have a partially created drop app.";
- exit 73;
- fi;
-